<link rel="stylesheet" href="/assets/libs/editormd/css/editormd.css"/>
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">项目名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" value="{$model.name ?? ''}" required placeholder="请输入项目名称" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所属部门</label>
        <div class="layui-input-block">
            <select name="group_id" lay-verify="required" lay-search="">
                <option value="">直接选择或搜索选择</option>
                {foreach $group as $key=>$vo}
                <option value="{$vo.id}" {if condition="($model.group_id eq $vo.id)" }selected{/if}>{$vo.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">项目周期</label>
        <div class="layui-input-block">
            <input type="text" name="period" id="period" required placeholder="请输入项目周期" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            {if $model['status'] eq 1}
            <input type="radio" name="status" value="1" title="正常" checked>
            <input type="radio" name="status" value="0" title="禁用">
            {else}
            <input type="radio" name="status" value="1" title="正常">
            <input type="radio" name="status" value="0" title="禁用" checked>
            {/if}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">项目描述</label>
        <div class="layui-input-block">
            <div id="test-editormd" style="height: 700px !important;">
                <textarea style="display:none;" name="content">{$model.content}</textarea>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</div>
<script src="/static/admin/video/jquery.js"></script>
<script src="/assets/libs/editormd/editormd.min.js"></script>
<script src="/static/admin/layui/layui.js"></script>

<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
        treeTable: '../admin/lib/extend/authtree'
    }).use(['index', 'form', 'laydate'], function () {
        var $ = layui.$, form = layui.form, laydate = layui.laydate;
        //日期范围
        laydate.render({
            elem: '#period'
            , range: '~'
            , value: "{$model.period}"
            , format: "yyyy-MM-dd"
            , trigger: 'click'//呼出事件改成click
        });
    });
</script>
<script type="text/javascript">
    var testEditor;
    $(function () {
        testEditor = editormd("test-editormd", {
            width: "100%",
            height: 340,
            path: "/assets/libs/editormd/lib/",
            codeFold: true,
            //syncScrolling : false,
            saveHTMLToTextarea: true,    // 保存 HTML 到 Textarea
            searchReplace: true,
            //watch : false,                // 关闭实时预览
            htmlDecode: "style,script,iframe|on*",            // 开启 HTML 标签解析，为了安全性，默认不开启
            //toolbar  : false,             //关闭工具栏
            //previewCodeHighlight : false, // 关闭预览 HTML 的代码块高亮，默认开启
            emoji: false,
            taskList: true,
            tocm: true,         // Using [TOCM]
            tex: true,                   // 开启科学公式TeX语言支持，默认关闭
            flowChart: true,             // 开启流程图支持，默认关闭
            sequenceDiagram: true,       // 开启时序/序列图支持，默认关闭,
            //dialogLockScreen : false,   // 设置弹出层对话框不锁屏，全局通用，默认为true
            //dialogShowMask : false,     // 设置弹出层对话框显示透明遮罩层，全局通用，默认为true
            //dialogDraggable : false,    // 设置弹出层对话框不可拖动，全局通用，默认为true
            //dialogMaskOpacity : 0.4,    // 设置透明遮罩层的透明度，全局通用，默认值为0.1
            //dialogMaskBgColor : "#000", // 设置透明遮罩层的背景颜色，全局通用，默认为#fff
            imageUpload: true,
            imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
            imageUploadURL: "{:url('project/uploadImg')}",
        });


    });
</script>